package com.ruoyi.web.controller.presure;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pressure.domain.KyLaneDblcAbnormal;
import com.ruoyi.pressure.service.IKyLaneDblcAbnormalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 顶 板离层测点异常信息数据项说明Controller
 * 
 * @author ruoyi
 * @date 2024-11-06
 */
@RestController
@RequestMapping("/pressure/dblcabnormal")
public class KyLaneDblcAbnormalController extends BaseController
{
    @Autowired
    private IKyLaneDblcAbnormalService kyLaneDblcAbnormalService;

    /**
     * 查询顶 板离层测点异常信息数据项说明列表
     */
    @PreAuthorize("@ss.hasPermi('pressure:dblcabnormal:list')")
    @GetMapping("/list")
    public TableDataInfo list(KyLaneDblcAbnormal kyLaneDblcAbnormal)
    {
        startPage();
        List<KyLaneDblcAbnormal> list = kyLaneDblcAbnormalService.selectKyLaneDblcAbnormalList(kyLaneDblcAbnormal);
        return getDataTable(list);
    }

    /**
     * 导出顶 板离层测点异常信息数据项说明列表
     */
    @PreAuthorize("@ss.hasPermi('pressure:dblcabnormal:export')")
    @Log(title = "顶 板离层测点异常信息数据项说明", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KyLaneDblcAbnormal kyLaneDblcAbnormal)
    {
        List<KyLaneDblcAbnormal> list = kyLaneDblcAbnormalService.selectKyLaneDblcAbnormalList(kyLaneDblcAbnormal);
        ExcelUtil<KyLaneDblcAbnormal> util = new ExcelUtil<KyLaneDblcAbnormal>(KyLaneDblcAbnormal.class);
        util.exportExcel(response, list, "顶 板离层测点异常信息数据项说明数据");
    }

    /**
     * 获取顶 板离层测点异常信息数据项说明详细信息
     */
    @PreAuthorize("@ss.hasPermi('pressure:dblcabnormal:query')")
    @GetMapping(value = "/{kyLaneDblcAbnormalId}")
    public AjaxResult getInfo(@PathVariable("kyLaneDblcAbnormalId") String kyLaneDblcAbnormalId)
    {
        return success(kyLaneDblcAbnormalService.selectKyLaneDblcAbnormalByKyLaneDblcAbnormalId(kyLaneDblcAbnormalId));
    }

    /**
     * 新增顶 板离层测点异常信息数据项说明
     */
    @PreAuthorize("@ss.hasPermi('pressure:dblcabnormal:add')")
    @Log(title = "顶 板离层测点异常信息数据项说明", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KyLaneDblcAbnormal kyLaneDblcAbnormal)
    {
        return toAjax(kyLaneDblcAbnormalService.insertKyLaneDblcAbnormal(kyLaneDblcAbnormal));
    }

    /**
     * 修改顶 板离层测点异常信息数据项说明
     */
    @PreAuthorize("@ss.hasPermi('pressure:dblcabnormal:edit')")
    @Log(title = "顶 板离层测点异常信息数据项说明", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KyLaneDblcAbnormal kyLaneDblcAbnormal)
    {
        return toAjax(kyLaneDblcAbnormalService.updateKyLaneDblcAbnormal(kyLaneDblcAbnormal));
    }

    /**
     * 删除顶 板离层测点异常信息数据项说明
     */
    @PreAuthorize("@ss.hasPermi('pressure:dblcabnormal:remove')")
    @Log(title = "顶 板离层测点异常信息数据项说明", businessType = BusinessType.DELETE)
	@DeleteMapping("/{kyLaneDblcAbnormalIds}")
    public AjaxResult remove(@PathVariable String[] kyLaneDblcAbnormalIds)
    {
        return toAjax(kyLaneDblcAbnormalService.deleteKyLaneDblcAbnormalByKyLaneDblcAbnormalIds(kyLaneDblcAbnormalIds));
    }

    /**
     * 顶板离层近7日报警
     */
    @GetMapping("/getDblcValueList")
    public List getDblcValueList() {
        List<String> list = kyLaneDblcAbnormalService.getDblcValueList();
        return list;
    }

}
